package day4

object Test1_Map {
  def main(args: Array[String]): Unit = {
    val arr =  Array[Int](1, 2, 3, 4, 5)
    val arr2: Array[Int] = arr.map(m1)
    val arr3 = arr.map((i:Int) => i * 3) // 匿名函数的写法

    for (elem <- arr3) {
      println(elem)
    }
  }

  def m1(i:Int): Int = {
    i * 2
  }
}
